

#ifndef OpenCVWrapper_h
#define OpenCVWrapper_h

#import <Foundation/Foundation.h>
#import <UIKit/UIKit.h>

@interface OpenCVWrapper : NSObject

#pragma mark - opencv的版本号
+ (NSString*) openCVVersionString;

#pragma mark - 转灰度图
+ (UIImage *)convertToGrayscale:(UIImage *)image;

#pragma mark - 矩阵的仿射变化
+ (UIImage *)warpAffineImage:(UIImage *)image
                  srcPoints:(NSArray<NSValue *> *)srcPoints
                  dstPoints:(NSArray<NSValue *> *)dstPoints
                 outputSize:(CGSize)size;

#pragma mark - 计算直方图 (参数与Python版完全对应)
+ (NSArray<NSNumber *> *)calcHistForImage:(UIImage *)image
                               channel:(int)channel
                               mask:(UIImage *_Nullable)mask
                               histSize:(int)histSize
                               ranges:(NSArray<NSNumber *> *)ranges;

#pragma mark - 计算归一化直方图 (按像素总数归一化)
+ (NSArray<NSNumber *> *)calcNormalizedHistForImage:(UIImage *)image
                                         channel:(int)channel
                                         mask:(UIImage *_Nullable)mask
                                         histSize:(int)histSize
                                         ranges:(NSArray<NSNumber *> *)ranges;

#pragma mark - 透视变换
/// 四点透视变换
/// @param image 输入图像
/// @param corners 源图像的四个角点（左上、左下、右上、右下）
+ (UIImage *)warpPerspective:(UIImage *)image
                  withCorners:(NSArray<NSValue *> *)corners;

#pragma mark - 图像处理
/// 中值滤波 (ksize=3)
+ (UIImage *)medianBlur:(UIImage *)image;

#pragma mark - 颜色空间转换
/// 转换为Lab颜色空间
+ (UIImage *)convertToLab:(UIImage *)image;

#pragma mark - 颜色统计
/// 计算Lab图像各通道均值 (返回数组: L, a, b)
+ (NSArray<NSNumber *> *)labMeanValues:(UIImage *)image;

+ (NSArray<NSNumber *> *)calculateHistogramFeaturesForImage:(UIImage *)image;

/// 分析图像清晰度并返回统计信息
/// @param image 输入图像
/// @return [明显不清晰区域数量, 比较不清晰区域数量]
+ (NSArray<NSNumber *> *)analyzeImageSharpness:(UIImage *)image;

@end

#endif
